home *** CD-ROM | disk | FTP | other *** search
- From: Roman Lechtchinsky <wolfro@cs.tu-berlin.de>
- Message-ID: <3178D6BB.7167@cs.tu-berlin.de>
- X-Original-Date: Sat, 20 Apr 1996 14:21:15 +0200
- Path: in2.uu.net!bounce-back
- Date: 20 Apr 96 16:16:11 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: Re: Member templates
- Organization: Technical University of Berlin
- References: <31763F3F.805@cs.tu-berlin.de> <xsoivewlve3.fsf@avs.cs.rpi.edu>
- X-Mailer: Mozilla 2.0 (Win95; I)
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMXkN2OEDnX0m9pzZAQHy/gF/VoSenJZSKyw8qJYAfKGEDJ4wvQIMmolU
- fg+XHap8/IAfE+dP8YuT0/rnJnIxD7vx
- =zfNa
-
- David Vandevoorde wrote:
- >
- > >>>>> "RL" == Roman Lechtchinsky <wolfro@cs.tu-berlin.de> writes:
- > [...]
- > RL> class Base
- > RL> {
- > RL> virtual void f(int);
- > RL> };
- >
- > RL> class Derived : Base
- > RL> {
- > RL> template<class T> void f(T);
- > RL> };
- >
- > RL> Is this legal? If so, will the template function f(int) override
- > RL> Base::f(int)? If so, when will it be instantiated? And, last but not
- > RL> least, which section of the DWP handles this case? Thanks in advance.
- >
- > I believe this is legal and the instantiated member function is not
- > virtual (i.e., no overriding), but my reason extrapolates the WPs
- > somewhat. I base this on the fact that the `signature' of a template
- > function includes the actual template arguments ([temp.over.link]
- > 14.10.4/3 in the April CD), and that when [class.virtual] 10.3/2
- > requires `same name', `name' really means template-id and not just
- > template-name ([temp.names] 14.1).
- >
-
- IMO, this means that f cannot be overridden in Derived:
-
- class Derived : Base
- {
- template<class T> void f(T);
- void f(int);
- };
-
- would be a specialization which means that f doesn't override as it is still
- a template ( [temp.over.spec] 14.10.5 ). Is this interpretation correct?
-
- Bye
-
- Roman
- ---
- [ comp.std.c++ is moderated. To submit articles: try just posting with ]
- [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
- [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
- [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
- [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
-